#pragma once

#pragma unmanaged

#include <BWSAL\BuildState.h>

#pragma managed

#include "BuildEvent.h"

namespace BroodWar
{
	namespace Addon
	{
		ref class WorkerManager;
		ref class BuildUnit;
		ref class TaskExecutor;
		ref class TaskScheduler;
		ref class Task;

		public ref class BuildState
		{
		internal:
			bool dispose;
			BWSAL::BuildState* instance;

			BuildState(BWSAL::BuildState* state);
			BuildState(BWSAL::BuildState state);
			~BuildState();
			!BuildState();
		public:
			BuildState();

			void ContinueToTime(int time);
			void DoEvent(BuildEvent^ e);
			void UpdateWithCurrentGameState();
			void CreateUnclaimedBuildUnits();
			int GetNextTimeWithMinimumResources(int minerals, int gas);
			int GetInsufficientTypes(BuildType buildType);
			bool IsSupplyBlocked(Task^ t);
			property int Time { int get(); }
			property double Minerals { double get(); }
			property double Gas { double get(); }
			property int SupplyAvailable { int get(); }
			property int SupplyTotal { int get(); }
			property int SupplyUsed { int get(); }
			property int MineralWorkers { int get(); }
			property int GasWorkers { int get(); }
			property unsigned int CompletedBuildTypes { unsigned int get(); }

			property int ReservedMinerals { int get(); void set(int reserve); }
			property int ReservedGas { int get(); void set(int reserve); }
		};

		BuildState^ ConvertBuildState(BWSAL::BuildState state);
		BWSAL::BuildState ConvertBuildState(BuildState^ state);
	}
}
